import { useEffect, useState } from "react"

function Text() {
    const [num, setNum] = useState(1)
    useEffect(() => {
        console.log("挂载完毕，更新完毕")
        return () => {
            console.log("挂载完毕")
        }
    }, [])
    useEffect(() => {
        console.log("num更新", num)
        return () => {
            console.log("num更新前", num)
        }
    }, [num])
    return (
        <button onClick={() => setNum(num + 1)}>{num}</button>
    );
}

export default Text;